package top.happylaishop.shop.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import top.happylaishop.shop.utils.SnowFlake;

@Configuration
public class MyConfigurer implements WebMvcConfigurer {

    @Value("${web.file.prefix}")
    private String webFilePrefix;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler(webFilePrefix + "/**").addResourceLocations("file:D:/data/happylaishop/");
    }

    @Bean
    public SnowFlake snowFlake(){
        return new SnowFlake();
    }
}